<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询结果</title>
<link href="../../css/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../js/clientSideApp.js"></script>
<script language="JavaScript" type="text/javascript" src="../../js/win_center.js"></script>

  <link href="../../css/style.css" rel="stylesheet" type="text/css">
  <link href="../../bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">

  <script src="../../bootstrap-3.3.7-dist/js/jquery-3.4.1.min.js"></script>
  <script src="../../bootstrap-3.3.7-dist/js/bootstrap.js"></script>
<SCRIPT language=JavaScript type=text/JavaScript>
function windowOpen(theURL,winName,features,width,hight,scrollbars,top,left) 
{
  var parameter="top="+top+",left="+left+",width="+width+",height="+hight;
  if(scrollbars=="no")
 {parameter+=",scrollbars=no";}
  else
 {parameter+=",scrollbars=yes";}
  window.open(theURL,winName,parameter);
}
</SCRIPT>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="25" align="center" valign="bottom" class="td06"><table width="98%" border="0" cellspacing="3" cellpadding="0">
      <tr>
        <td width="15"><img src="../../images/index_32.gif" width="9" height="9"></td>
        <td valign="bottom" class="title">查询入库单</td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td class="td_page">入库单编号：
      <input name="textfield2" type="text" class="waeid" size="20">　

      <input type="button"  class="button_select" onClick="fPopUpCalendarDlg('PARA_YM_NOW1')">

     <input name="Submit" type="button" class="select01" value=" 查询 ">

     <a href="#" onClick="javascript:openwindow('../org/QUERY/index.html','',500,500)"> </a>
</td>
  </tr>
</table>
  <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table001">
    <tr>
      <td class="td_page">

        选择：
        <select name="" id="" class="_select">
          <option value="staid">入库人工号</option>

        </select>  
        <input name="textfield2" type="text" class="inputval" size="20">　
        入库日期：
        <input name="textfield2" type="date" class="waedate" size="20">
        <input type="button"  class="button_select" onClick="fPopUpCalendarDlg('PARA_YM_NOW1')">

        <input name="Submit" type="button" class="select02" value=" 查询 ">

        <a href="#" onClick="javascript:openwindow('../org/QUERY/index.html','',500,500)"> </a>
      </td>
    </tr>
  </table>
<br>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table01">
  <tr class="_tr1">
    <td class="td_top">入库单号</td>
    <td class="td_top">入库人姓名</td>
    <td class="td_top">入库时间</td>




    <td nowrap class="td_top">操作</td>

  </tr>
  <tr> 
    <td class="td07"></td>
    <td class="td07"></td>
    <td class="td07"></td>

    <td class="td07">
      <button type='button' name='addgoods' data-toggle='modal' aria-pressed='false' data-target='#exampleModalCenter3'><span >查看</span></button>
    </td>


  </tr>

</table>
<table width="95%"  border="0" cellpadding="0" cellspacing="0" class="table02" align="center">
  <tr>
    <td height="30" align="right"><img src="../../images/1.gif" width="4" height="5" align="absmiddle"> 首页　 <img src="../../images/2.gif" width="3" height="5" align="absmiddle"> 上一页　 <img src="../../images/2-2.gif" width="3" height="5" align="absmiddle"> 下一页　 <img src="../../images/3.gif" width="4" height="5" align="absmiddle"> 末页　　共 1 页 1 条记录</td>
  </tr>
</table>
</form>
</body>
</html>
<script src="../../js/jquery.js"></script>
<script>
  $(".waeid").blur(function () {
    if($(this).val()!=""){

      $(".table001").find("input").attr("disabled","disabled");
      console.log($(".table001").find("input"));
    }else{

      $(".table001").find("input").removeAttr("disabled");
    }
  })
  $(".table001").find("input").blur(function () {
    if($(this).val()!=""){
      $(".waeid").attr("disabled","disabled");
    }else{
      $(".waeid").removeAttr("disabled");
    }
  })


var _data="";
  $(".select01").click(function () {
    $.ajax({
      url:"/feign/drugStorageController/findWaentry",
      type:"get",
      headers: {
        Accept: "application/json; charset=utf-8",
        Authorization: location.href.split("=")[1]
      },
      data:{"waeid": $(".waeid").val()},
      dataType:"json",
      success:function (data) {


        var _html="  <tr> \n" +
                "    <td class=\"waeid\">"+data.waeid+"</td>\n" +
                "    <td class=\"td07\">"+data.staffinfo.staname+"</td>\n" +
                "    <td class=\"td07\">"+data.waedate+"</td>\n" +
                "\n" +
                "    <td class=\"td07\">\n" +
                "      <button type='button' name='addgoods' data-toggle='modal' aria-pressed='false' data-target='#exampleModalCenter3' class='select' ><span >查看</span></button>\n" +
                "    </td>\n" +
                "\n" +
                "\n" +
                "  </tr>";
        $("._tr1").nextAll("tr").remove();
        $(".table01>").append(_html);
        $(".select").on("click",function () {

          _selectDrug();
          $.ajax({
            url: "/feign/drugStorageController/findDrugByWaeId",
            data: {"waeid": $('td.waeid').html()},
            type: "get",
            headers: {
              Accept: "application/json; charset=utf-8",
              Authorization: location.href.split("=")[1]
            },
            dataType: "json",
            success: function (data) {
              for(var i = 0; i<data.length;i++){

                $("#tbody").append("<tr>\n" +
                        "        <td class=\"td\">"+data[i].druginformation.drugname+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugnumber+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugprice+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugcategory.druname+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugdate+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.dugperiod+"(月)</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.price.pridunit+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.pharmacy.phaname+"</td>\n" +
                        "        <td class=\"td_\" width=\"70\">"+data[i].druginformation.drugplidate+"</td>\n" +
                        "\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugplival+"</td>\n" +
                        "        <td class=\"td_\">"+data[i].druginformation.drugnumber*data[i].druginformation.drugprice+"</td>\n" +
                        "      </tr>\n");
              }
            }
          })
        })
      }
    })

  })

  $(".select02").click(function () {
    var _select= $('._select option:selected').val();
    if(_select=="staid"){
      $.ajax({
        url:"/feign/drugStorageController/findWaentry",
        type:"get",
        data:{"staid":$(".inputval").val(),"waedate":$(".waedate").val()},
        headers: {
          Accept: "application/json; charset=utf-8",
          Authorization: location.href.split("=")[1]
        },
        dataType:"json",
        success:function (data) {
          var _html="";
          // debugger;
          console.log(data.length)
          console.log("data.length:"+data.length);
          for(var i=0; i < data.length;i++){

            _html+="  <tr> \n" +
                    "    <td class=\"waeid\">"+data[i].waeid+"</td>\n" +
                    "    <td class=\"td07\">"+data[i].staffinfo.staname+"</td>\n" +
                    "    <td class=\"td07\">"+data[i].waedate+"</td>\n" +
                    "\n" +
                    "    <td class=\"td07\">\n" +
                    "      <button type='button' name='addgoods' data-toggle='modal' aria-pressed='false' data-target='#exampleModalCenter3' data-id='' class='select' ><span >查看</span></button>\n" +
                    "    </td>\n" +
                    "\n" +
                    "\n" +
                    "  </tr>";

          }

          $("._tr1").nextAll("tr").remove();
          $(".table01>").append(_html);
          console.log(_html)
          // $("._tr1").after(_html);
          $(".select").on("click",function () {
            _selectDrug()
            $.ajax({
              url: "/feign/drugStorageController/findDrugByWaeId",
              data: {"waeid": $('td.waeid').html()},
              headers: {
                Accept: "application/json; charset=utf-8",
                Authorization: location.href.split("=")[1]
              },
              type: "get",
              dataType: "json",
              success: function (data) {
                for(var i = 0; i<data.length;i++){

                  $("#tbody").append("<tr>\n" +
                          "        <td class=\"td\">"+data[i].druginformation.drugname+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugnumber+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugprice+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugcategory.druname+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugdate+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.dugperiod+"(月)</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.price.pridunit+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.pharmacy.phaname+"</td>\n" +
                          "        <td class=\"td_\" width=\"70\">"+data[i].druginformation.drugplidate+"</td>\n" +
                          "\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugplival+"</td>\n" +
                          "        <td class=\"td_\">"+data[i].druginformation.drugnumber*data[i].druginformation.drugprice+"</td>\n" +
                          "      </tr>\n");
                }
              }
            })
          })
        }
      })
    }

  })





  function _selectDrug() {
    $("body").append(
            "<div class='modal fade' id='exampleModalCenter3' tabindex='-1' role='dialog' aria-hidden='true'>"+
            "<div class='modal-dialog modal-dialog-centered' role='document'>"+
            "<div class='modal-content'>"+
            "<div class='modal-header text-center'>"+
            "<label class='mb-2'>四川和平医院</label>"+
            "<button type='button' class='close' data-dismiss='modal' aria-label='Close'>"+
            "<span aria-hidden='true'>&times;</span>"+
            "</button></div><div class='modal-body'><div class='login px-4 mx-auto mw-100'>"+
            "<form action='' method='post' enctype='multipart/form-data' id='goodsAdd'><div class='form-group'>"+
            // "<input class='browsers' list='browsers' placeholder='选择或输入添加商品类型'>"+
            "<label class='mb-2'>消费详情表格</label><br>"+
            "<div class=\"table-responsive\">\n" +
            "    <table class=\"table table-striped table-hover\" id='tbody'>\n" +
            "<tr>\n" +
            "\n" +
            "        <td class=\"td\">药品名称</td>\n" +
            "        <td class=\"td_\">药品数量</td>\n" +
            "        <td class=\"td_\">单价</td>\n" +
            "        <td class=\"td_\">药品类别</td>\n" +
            "        <td class=\"td_\">生产日期</td>\n" +
            "        <td class=\"td_\">有效期(月)</td>\n" +
            "        <td class=\"td_\">库存单位</td>\n" +
            "        <td class=\"td_\">药房</td>\n" +
            "        <td class=\"td_\" width=\"70\">报警日期</td>\n" +
            "\n" +
            "        <td class=\"td_\">报警值</td>\n" +
            "        <td class=\"td_\">总价</td>\n" +
            "      </tr>\n"+
            "    </table>\n" +
            "</div>"+
            "</form></div></div></div></div></div>")
    }



</script>
